#include "bga/graphics/VertexArrayObject.h"


namespace bga
{

VertexArrayObject::VertexArrayObject() : GLObject()
{
    /// generate object id
    this->id = generate();
}

VertexArrayObject::~VertexArrayObject()
{
    glDeleteVertexArrays(1, &(this->id));
}

void VertexArrayObject::bind() const
{
    glBindVertexArray(this->id);
}

void VertexArrayObject::unbind() const
{
    glBindVertexArray(0);
}


GLuint VertexArrayObject::generate() const
{
    GLuint id;
    glGenVertexArrays(1, &id);
    return id;
}

}


